using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Nizm0.QOT.Library.Scripts
{
    static class SearchForInstancesOfSQL
    {
        //private string text;

        public static ArrayList PodajInstancjeSQL()
        {
            ArrayList WidoczneInstancje = new ArrayList();
            try
            {
                //comboBox_ServerTest.Items.Clear();
                SQLDMO.Application app = new SQLDMO.Application();
                SQLDMO.NameList names = app.ListAvailableSQLServers();
                /*
                if (names.Count == 0)
                {
                    WidoczneInstancje.Add("Brak lokalnych");
                }
                else
                {
                 */
                foreach (string name in names)
                {
                    WidoczneInstancje.Add(name);
                }
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return WidoczneInstancje;
        }
    }
}
